# -*- coding:utf-8 -*-
import requests
from hyper.contrib import HTTP20Adapter

session = requests.session()
headers = {
    'user-agent': 'yuanrenxue.project',
    "Cookie": "sessionid=pwin2ge9j7t9ttj5m15pjwar9m4sj9tc;",
}
session.headers.update(headers)
# 使用http2.0
session.mount('https://match.yuanrenxue.com', HTTP20Adapter())


def get_data(page):
    url = f'https://match.yuanrenxue.com/api/match/17?page={page}'
    return session.get(url).json()


def main():
    value_list = []
    for page in range(1, 6):
        res = get_data(page)
        print("res==>", res)
        value_list += [v['value'] for v in res['data']]
    print(value_list)
    print(sum(value_list))


if __name__ == '__main__':
    main()
